//
//  Auction_taiziselling_VC_WX.m
//  ZITHER
//
//  Created by weixin on 2019/6/4.
//  Copyright © 2019 weixn. All rights reserved.
//

#import "Auction_taiziselling_VC_WX.h"
#import "Auction_taiziselling_Tbv_WX.h"
#import "Main_Title_View_WX.h"
#import "Auction_taizisellingSelect_Tbv_WX.h"
#import "specialSaleSceneid.h"
#import "specialSaleBrandListModel.h"


@interface Auction_taiziselling_VC_WX ()
@property (nonatomic,strong)Auction_taiziselling_Tbv_WX * tbv;
@property (nonatomic, strong)Main_Title_View_WX * TitleV;
@property (nonatomic,strong)Auction_taizisellingSelect_Tbv_WX * tbvSelect;


@end

@implementation Auction_taiziselling_VC_WX

- (void)viewDidLoad {
    [super viewDidLoad];
    [self setNav];
    [self setUI];
}

-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
    [self loadDatapecialSale];

}
-(void)setNav{
    
    BaseLab * titleLab = [BaseLab initCustomLab:@"太子专场" color:HexColor(0x333333) font:[UIFont fontWithName:@"PingFang-SC-Regular" size:17]];
    [self.baseNavigationView addSubview:titleLab];
    
    [titleLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.baseNavigationView).offset(30);
        make.bottom.equalTo(self.baseNavigationView).offset(-10);
    }];
    
    BaseLab * titleSubLab = [BaseLab initCustomLab:@"下一场5月24日10:00开卖" color:HexColor(0xff6f6f) font:[UIFont fontWithName:@"PingFang-SC-Regular" size:15]];
    [self.baseNavigationView addSubview:titleSubLab];
    
    [titleSubLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.baseNavigationView).offset(-15);
        make.bottom.equalTo(self.baseNavigationView).offset(-5);
    }];
    
}

-(void)setUI{
    [self.view addSubview:self.TitleV];

    [self.tbv mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.view).offset(NaviHeight+40);
        make.left.right.equalTo(self.view).offset(0);
        make.bottom.equalTo(self.view).offset(0);
    }];
    [self.tbvSelect mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.view).offset(NaviHeight+40);
        make.left.right.equalTo(self.view).offset(0);
        make.bottom.equalTo(self.view).offset(0);
    }];
    
}

-(void)loadData{
    NSString *str = @"cfd7442d3e854ac6ae826b894cba768c";
    NSInteger page = self.tbv.page;
    
    [[serviceDefualt loadspecialSaleSceneid:str brandId:@"" sexId:@"" page:page reponseObjctClass:[specialSaleSceneid class]]subscribeNext:^(ResponseData * x) {
        if (x.success) {
//            specialSaleSceneid *modelRes = x.responseData;
//            if (modelRes.list.count == 0) {
//                if (page == 0 ) {
//                    [Tools showTips:@"暂无更多数据"];
//                    [self.CollectionView.mj_header endRefreshing];
//                    [self.CollectionView.mj_footer endRefreshing];
//                }else{
//                    [self.CollectionView.mj_footer endRefreshingWithNoMoreData];
//                }
//                return ;
//            }
//
//            if (page == 0) {
//                [self changeData:x.responseData];
//            }else{
//                specialSaleSceneid *model = x.responseData;
//                for (specialSaleSceneidList *modelList in model.list) {
//                    [self.CollectionView.model.list addObject:modelList];
//                }
//                model.list = self.CollectionView.model.list;
//                self.CollectionView.model = model;
//                [self.CollectionView reloadData];
//            }
//            [self.CollectionView.mj_header endRefreshing];
//            [self.CollectionView.mj_footer endRefreshing];
            
        }else{
            [Tools showTips:x.errorInfo];
        }
        
    }];
    
}



-(void)loadDatapecialSale{
    
#pragma mark - --- 获取筛选品牌列表
#pragma mark - --- 获取筛选列表
    [self rac_liftSelector:@selector(updateUIWithBrandData:SexData:) withSignalsFromArray:@[[serviceDefualt loadspecialSaleBrandList:[specialSaleBrandListModel class]],[serviceDefualt loadspecialSaleSexList:[specialSaleBrandListModel class]]]];
}

- (void)updateUIWithBrandData:(id )BrandData SexData:(id )SexData {
    NSLog(@"%@",[NSThread currentThread]);
    //拿到数据更新UI
    NSLog(@"UI!!%@%@",BrandData,SexData);
}







-(Auction_taiziselling_Tbv_WX *)tbv{
    if (!_tbv) {
        _tbv = [[Auction_taiziselling_Tbv_WX alloc]initializeFrame:CGRectZero isMj:2 isEstimatedRowHeight:YES addRegisterNib:@[@"Auction_taiziselling_Cell_WX"]];
        [self.view addSubview:_tbv];
        
    }
    return _tbv;
}
- (Auction_taizisellingSelect_Tbv_WX *)tbvSelect{
    if (!_tbvSelect) {
        _tbvSelect = [[Auction_taizisellingSelect_Tbv_WX alloc]initializeFrame:CGRectZero isMj:2 isEstimatedRowHeight:YES addRegisterNib:@[@"Auction_taizisellingSelect_Cell_WX"]];
        _tbvSelect.backgroundColor = [UIColor colorWithRed:0/255.0 green:0/255.0 blue:0/255.0 alpha:0.5];
        [self.view addSubview:_tbvSelect];
        
    }
    return _tbvSelect;
}

#pragma mark *** getter ***

-(Main_Title_View_WX *)TitleV{
    if (!_TitleV) {
        _TitleV = [[Main_Title_View_WX alloc]initWithFrame:CGRectMake(0,NaviHeight, SCREEN_WIDTH, 40 )];
        [_TitleV setShadowType1WithColor:[UIColor defaultShadowColor] offset:CGSizeMake(0, 5) opacity:1 radius:3];
        _TitleV.blackView.hidden = YES;
        NSMutableArray *arrMNormal = [[NSMutableArray alloc]initWithArray:@[@"品牌",@"性别",@"价格"]];
        _TitleV.arrMNormal = arrMNormal;
        _TitleV.state = MainTitleVStateTaizi;
        _TitleV.BtnFind.hidden = YES;
        _TitleV.BtnNew.hidden = YES;
        
        @weakify(self);
        [_TitleV setBlcokIndex:^(NSInteger index) {
            @strongify(self);
            self.tbvSelect.hidden = NO;

//            self.subScrollView.contentOffset = CGPointMake(index*kScreenW,0);
        }];
    }
    return _TitleV;
}




@end
